In most cases a homeowner doesn't have to shoot an intruder. Just producing a gun is enough to hold the guy for police. A criminal's family also can sue for wrongful death if one isn't careful. When I received my first instruction back in the 80s, my instructor told me to never shoot anyone in the dark. Turn on the lights and take cover behind a bed or a desk. If an intruder has a knife, and you have time to issue a verbal command, it's probably a good idea to do so. But if they have a gun, you're under no obligation to warn. Shoot them until they're no longer a threat.
The worse thing you can do is to try to talk to someone with a gun. Experience has shown you can't shoot and talk at the same time. And cops have recently learned that a determined man with a knife can reach someone armed with a gun and carve them up before being stopped (20 feet is the distance they've determined for cops).
I live in a horribly anti-gun state, but I just won't go into a national park unless I'm armed, legally or otherwise. When I was younger, I worked for the NRA and I've interviewed park rangers, people attacked by bears -- but one of the most interesting guys I talked to was literally terrorized by a man who threatened his family. He'd shoot into the guy's house into lit rooms and the police could never prove it was him. One night the bad guy broke into this fellow's house. In the firefight that ensued, he was forced into the back yard and hid behind a refrigerator that was under repair.
"I had a speedloader loaded with armor-piercing ammo," he said, "and I fired four shots at the refrigerator. I was about to shoot again when the guy just fell dead sideways." When I asked where he'd gotten the ammo, he said he made it from a steel dow and cut it in pieces and reloaded it. He was completely exonerated, but in this case his primary fear was that the guy would live to come back and harm his family. "He wanted to harm me by killing my wife or kids, and there was clearly something wrong with the guy, but I didn't care -- he had it in for my family." He had them trained to hit the floor when they heard shots fired.